package com.aerotechnic.bo;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.aerotechnic.dao.UserDao;
import com.aerotechnic.models.User;

@Service("UserBo")
public class UserBo implements BOLayer<User> {

	@Autowired
	private UserDao userDao;

	public void setSurveillantDAO(UserDao userDAO) {
		this.userDao = userDAO;
	}

	@Override
	public boolean save(User myEntity) {
		userDao.save(myEntity);
		return true;
	}

	@Override
	public void update(User myEntity) {
		userDao.update(myEntity);

	}

	@Override
	public void delete(User myEntity) {
		userDao.delete(myEntity);

	}

	@Override
	public User findByID(Long myEntityID) {
		return userDao.findByID(myEntityID);
	}

	@Override
	public List<User> findAll() {
		return userDao.findAll();
	}

	public User authenticate(String login, String password) {
		return userDao.authenticate(login, password);
	}

}
